/**
 * 
 */
var infoWindowAMShown = false;
var infoWindowAMTimer;

function showModalInfoWindow()
{
	if(!counter)
		counter=0;
	if(!infoWindowAMShown){
		Richfaces.showModalPanel('ajaxLoadingModalBox');
		infoWindowAMShown=true;
	}
    infoWindowAMTimer = setTimeout("updateCounter()", 3*60*1000);
}

function updateCounter() {
	document.getElementById("time").innerHTML=++counter;
}

function hideModalInfoWindow()
{
    if (infoWindowAMShown) {
        Richfaces.hideModalPanel('ajaxLoadingModalBox');
        infoWindowAMShown = false;
    } else {
        if(infoWindowAMTimer)
            clearTimeout(infoWindowAMTimer);
    }

}

var counter=0;
var timer=0;
function startTicker()
{
	setLinksDisable();
	if(!counter)
		counter=0;
	timer=setTimeout("updateTimer()",1000);

}
function updateTimer()
{
	if(timer)
		clearTimeout(timer);
	document.getElementById("time").innerHTML=++counter;
	//if(counter<35)
	if (counter<90) {
		timer=setTimeout("updateTimer()",1000);
	} else {
		parent.parent.parent.workingarea.frames['loadingBottomFrame'].location.href="/blank.html";
        parent.parent.parent.workingarea.frames['loginTopFrame'].location.href="/serviceunavailable.html";
		setLinksEnable();
	}
}
function clearTicker(){
	setLinksEnable();
	counter=0;
	clearTimeout(timer);
}